/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sp.component;

import java.awt.Color;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import javax.swing.JTextArea;

/**
 *
 * @author Thosan Girisona S
 */
public final class TextAreaCatatan extends JTextArea{

    public TextAreaCatatan() {
        super();
        setFocus();
    }

    public void setFocus() {
        setAutoscrolls(true);
        setText("");
        addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(FocusEvent e) {
                super.focusGained(e); //To change body of generated methods, choose Tools | Templates.
                setBackground(Color.yellow);
            }

            @Override
            public void focusLost(FocusEvent e) {
                super.focusLost(e); //To change body of generated methods, choose Tools | Templates.
                setBackground(Color.white);
            }

        });
    }
}
